﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Logoned.Master" Inherits="System.Web.Mvc.ViewPage<CourseSystem.Core.Entities.ExaminationInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    考试
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <% Html.RenderPartial("TopUc"); %>
        <% Html.RenderPartial("NavUc", 3); %>
        <% Html.RenderPartial("ExamLibNavUc", 2); %>
    </table>
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td height="200" align="center" valign="top" class="contentBackImg">
                <table width="950" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="28" align="left" background="<%=ResolveUrl("~/Content/images/5_01_1.gif")%>">
                            <table width="343" height="28" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="18">
                                    </td>
                                    <td width="325">
                                        <div align="left" class="style18">
                                            <strong><span class="style48">考试-<%=Model.Title %></span></strong><span class="style11">
                                                
                                            </span>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" valign="top" background="<%=ResolveUrl("~/Content/images/5_02_1.gif")%>">
                            <table width="944" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="center" valign="top" bgcolor="#FFFFFF">
                                        <table width="50%" height="2" border="0" align="center" cellpadding="0" cellspacing="0"
                                            bordercolor="#FFFFFF">
                                            <tr>
                                                <td bgcolor="#FFFFFF">
                                                </td>
                                            </tr>
                                        </table>
                                        <div align="left">
                                        </div>
                                        <table width="944" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="center" valign="top">
                                                    <table width="600" height="200" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td>
                                                                <div align="center">
                                                                    <p>
                                                                        <span class="style41">
                                                                            <%=Model.Title %></span></p>
                                                                    <p>
                                                                        <span class="style42">共<%=Model.ExaminationItemInfo.Count %>道题 试卷满分值：<%=Model.Score %></span>
                                                                    </p>
                                                                    <p id="countDownP">
                                                                    </p>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% Html.RenderPartial("ExamDoUc", Model); %>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="13" bgcolor="#FFFFFF">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="3" background="<%=ResolveUrl("~/Content/images/5_04_1.gif")%>">
                        </td>
                    </tr>
                </table>
                <table width="1000" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="10">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <style type="text/css">
        .stylenew1 { font-size: 14px; font-weight: bold; font-family: "宋体"; color: #BC7E3F; }
        .stylenew2 { font-size: 36px; font-family: "宋体"; color: #0000FF; font-weight: bold; }
        .stylenew3 { font-size: 18px; }
        .stylenew4 { font-size: 12px; font-family: "宋体"; }
        .stylenew8 { color: #FF0000; }
        .stylenew10 { color: #33CC66; }
        .stylenew13 { color: #FFCC33; }
    </style>
    <script src="<%=ResolveUrl("~/Scripts/jquery.jcountdown1.3.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        var reExam = '<%=ViewData["reExam"] %>';
        $(function () {
            alert("考试过程请及时保存答案!");
            $(document).bind("contextmenu", function (e) {
                return false;
            });
            $(document).keydown(function () {
                return false;
            });
            $("#submitSubmit").click(function () {
                if (confirm('是否退出考试并交卷，交卷后不能继续考试?'))
                    return true;
                return false;
            });
            if (true) {
                $("#countDownP").countdown({
                    date: strToTime('<%=Model.EndTime.ToString("yyyy-MM-dd HH:mm:ss") %>'), //Counting TO a date
                    htmlTemplate: "<span class=\"stylenew2\">%{h}<span class=\"stylenew3\">时</span>%{m}<span class=\"stylenew3\">分</span>%{s}<span class=\"stylenew3\">秒</span></span>",
                    //date: "july 1, 2011 19:24", //Counting TO a date
                    onChange: function (event, timer) {
                    },
                    onComplete: function (event) {
                        $(this).html("<span class=\"stylenew2 stylenew8\">已结束</span>");
                        // $("#submitSubmit").click();
                        //采用以下方式提交可防止事件
                        document.examForm.action = document.examForm.action + "?Submit=提交";
                        document.examForm.submit();
                        $("#countDownP").countdown('pause');
                    },
                    leadingZero: true
                });
            }

            setInterval("getStatus()", 1000 * 60);
        });
        var isWarn = false;
        var getStatus = function () {
            $.getJSON(appRoot + "Ajax/GetExamStatus/<%=Model.Id %>?rd=" + rdTime(), function (data, textStatus) {
                if (data == null)
                    return;
                if (data.IsEnforceSubmit) {
                    document.examForm.action = document.examForm.action + "?Submit=提交";
                    document.examForm.submit();
                    return;
                }
                if (data.IsWarning && !isWarn) {
                    isWarn = true;
                    alert("你被监考老师警告了!");
                    return;
                }
            });
        };
    </script>
</asp:Content>
